import java.io.*;

import rath.nateon.*;
import rath.nateon.event.*;

public class Test
{
	public static void main( String[] args ) throws Exception
	{
		Debug.printInput = true;
		Debug.printOutput = true;

		final NateOnMessenger nateon = new NateOnMessenger(args[0], args[1]);
		nateon.setAutoAccept(true);
		nateon.addNateOnListener( new NateOnAdapter() {
			public void loginComplete( NateUser me )
			{
				System.out.println( "* Login complete: " + me );
			}

			public void smsReceived( String from, String to, String msg ) 
				throws IOException
			{
				System.out.println( "* SMS From: " + from );
				System.out.println( msg );
			}

			public void channelMessage( ChatChannel channel, String from, String font, String msg )
			{
				System.out.println( from + " says: " + msg );
				try
				{
					channel.sendMessage( "t-_-t" );
				}
				catch( IOException e )
				{
					e.printStackTrace();
				}
			}
		});
		nateon.login();
/*
		Thread.sleep( 5000L );
		System.out.println( "Send SMS..." );
		nateon.sendSMS( "01000000000", "dsalkdjsalkdjs" );
*/
	}
}
